"""
 encoding    : utf-8
 @File       : zhaopin_testcases.py
 @Author     : qin
 @Version    :
 @Description:
 @Date       : 2024/07/15
"""
import unittest
from ddt import ddt, data, unpack
from jmeter_code.invite_job_manage.common.interface import InterFace
from concurrent.futures import ThreadPoolExecutor

url = 'http://192.168.1.110:9810/admin/login'
data_list = {'account': 'admin', 'password': '123456', 'authCode': '8888'}

url1 = 'http://192.168.1.110:9810/recruit/listRecruitManage?page=1&size=20'
data_list1 = {"companyId": 0, "page": 1}


@ddt
class ZhaopinTestCase(unittest.TestCase):
    def setUp(self):
        self.login_port = InterFace(url)
        self.login_port.request_post(data_list)
        res = self.login_port.get_response_json()
        login_token = res['data']['access_token']
        self.headers = {'Authorization': 'Bearer ' + login_token}

    def tearDown(self):
        self.login_port.close_link()

    @unpack
    @data()
    def test_01(self):
        try:
            self.query = InterFace(url1)
            self.query.request_json_post(json=data_list1,headers=self.headers)
            ressult = self.query.get_response_json()
            self.assertEqual(ressult[''],'','测试失败')
        except AssertionError as e:
            print(e)
        finally:
            self.query.close_link()


if __name__ == '__main__':
    unittest.main()
